using System;
using System.Collections.Generic;
using System.Text;
using DTO;
using DAO;
using System.Data.SqlClient;
using System.Data;
namespace BUS
{
    public class KhachThuePhongBUS
    {
        public KhachThuePhongDTO[] LayDanhSachKT()
        {
            KhachThuePhongDTO[] KT= new KhachThuePhongDTO[100];
            try
            {
                KhachThuePhongDAO KTDao = new KhachThuePhongDAO();
                KT = KTDao.LayDanhSachKT();
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            return KT;
        }

        public int ThemKhachThue_Output(int MaKT, string HoTen, string CMND, string DienThoai, string DiaChi, int LoaiKhach)
        {
            try
            {
                KhachThuePhongDAO ktpDAO = new KhachThuePhongDAO();
                MaKT = ktpDAO.ThemKhachThue_Output(MaKT, HoTen, CMND, DienThoai, DiaChi, LoaiKhach);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return MaKT;
        }

        public void ThemKhachThue(string HoTen, string CMND, string DienThoai, string DiaChi, int LoaiKhach)
        {
            try
            {
                KhachThuePhongDAO ktDAO=new KhachThuePhongDAO();
                ktDAO.ThemKhachThue(HoTen, CMND, DienThoai, DiaChi, LoaiKhach);
            }
            catch (SqlException ex)
            {
                throw ex;
            }
        }
        public KhachThuePhongDTO[] TimKiemKhachThue(int MaKT)
        {
            KhachThuePhongDTO[] kt = new KhachThuePhongDTO[100];
            try
            {
                KhachThuePhongDAO KTDao = new KhachThuePhongDAO();
                kt = KTDao.TimKiemKhachThue(MaKT);
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            return kt;
        }
        public KhachThuePhongDTO[] TimKiemNangCao(KhachThuePhongDTO kt)
        {
            KhachThuePhongDTO[] arr = new KhachThuePhongDTO[100];
            try
            {
                KhachThuePhongDAO KTDao = new KhachThuePhongDAO();
                arr = KTDao.TimKiemNangCao(kt);
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            return arr;
        }
    }
}
